package com.zhuss.product.processor;

import com.zhuss.enums.OperationStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import com.zhuss.bean.vo.product.train.DetailTrainVo;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.exception.DzcxException;


@Component("trainCheck")
public class TrainCheck {

	@Autowired
	@Qualifier("trainRead")
	private TrainRead trainRead;


	public boolean checkStart(Long trainId) throws DzcxException {
		DetailTrainVo train = ((DetailTrainVo) trainRead.detail(trainId));
		if (OperationStatus.已停运.sameKey(train.getStatus()) || OperationStatus.未开通.sameKey(train.getStatus())) {
			return true;
		}
		return false;
	}

	public boolean checkStop(Long trainId) throws DzcxException {
		DetailTrainVo train = ((DetailTrainVo) trainRead.detail(trainId));
		if (OperationStatus.已开通.sameKey(train.getStatus())) {
			return true;
		}
		return false;
	}

}
